Skip to content

feat(UniverSheet): assets support fingerprinting - #1096

Merged
ArgoZhang merged 2 commits into
masterfrom
dev-unisheet
Aug 12, 2026
Merged

feat(UniverSheet): assets support fingerprinting#1096
ArgoZhang merged 2 commits into
masterfrom
dev-unisheet

Conversation

@ArgoZhang

@ArgoZhang ArgoZhang commented Aug 12, 2026

Copy link
Copy Markdown
Member

Link issues

fixes #1095

Summary By Copilot

Regression?

  • Yes
  • No

Risk

  • High
  • Medium
  • Low

Verification

  • Manual (required)
  • Automated

Packaging changes reviewed?

  • Yes
  • No
  • N/A

☑️ Self Check before Merge

⚠️ Please check all items below before review. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • Merge the latest code from the main branch

Summary by Sourcery

Add fingerprinted asset URL support for UniverSheet styles to improve cacheability and compatibility with .NET 9 asset handling.

New Features:

  • Allow UniverSheet to supply dynamic, fingerprinted URLs for its CSS assets to the client script.

Enhancements:

  • Load both univer bundle and sheet CSS files explicitly in the client script instead of relying on CSS imports for styling.

@bb-auto bb-auto Bot added the enhancement New feature or request label Aug 12, 2026
@bb-auto bb-auto Bot added this to the v10.0.0 milestone Aug 12, 2026
@sourcery-ai

sourcery-ai Bot commented Aug 12, 2026

Copy link
Copy Markdown

Reviewer's Guide

Adds asset fingerprinting support to UniverSheet by parameterizing CSS bundle URLs and resolving them through the Assets dictionary on .NET 9+, and adjusting the JS/stylesheet loading accordingly.

Sequence diagram for UniverSheet init with fingerprinted CSS assets

sequenceDiagram
    actor Browser
    participant UniverSheet as UniverSheetComponent
    participant Assets as AssetsDictionary
    participant JS as UniverSheet_razor_js
    participant Static as StaticCssFiles

    Browser->>UniverSheet: Render UniverSheet
    Note over UniverSheet: OnAfterRenderAsync(firstRender)
    UniverSheet->>Assets: Assets[UniverBundleStylePath]
    Assets-->>UniverSheet: univerBundleStyleUrl
    UniverSheet->>Assets: Assets[UniverSheetStylePath]
    Assets-->>UniverSheet: univerSheetStyleUrl
    UniverSheet->>JS: init(id, invoke, options{univerBundleStyleUrl, univerSheetStyleUrl})
    JS->>Browser: addLink(univerBundleStyleUrl)
    JS->>Browser: addLink(univerSheetStyleUrl)
    Browser->>Static: Request fingerprinted CSS
    Static-->>Browser: Serve univer-bundle.css, univer-sheet.bundle.css
Loading

File-Level Changes

Change Details Files
Expose fingerprint-aware CSS bundle URLs from the UniverSheet component to the JS initializer.
  • Introduce constants for the univer bundle and sheet CSS paths in the component.
  • Extend the options object passed to JS with UniverBundleStyleUrl and UniverSheetStyleUrl.
  • Implement properties that resolve CSS URLs via the Assets dictionary when running on .NET 9 or later, otherwise falling back to static paths.
src/components/BootstrapBlazor.UniverSheet/Components/UniverSheet.razor.cs
Update the UniverSheet JS init logic to use CSS URLs provided by the component instead of hard-coded paths.
  • Destructure univerBundleStyleUrl and univerSheetStyleUrl from the options parameter.
  • Load both bundle and sheet styles via addLink using the provided URLs.
src/components/BootstrapBlazor.UniverSheet/Components/UniverSheet.razor.js
Decouple univer-sheet.bundle.css from directly importing univer-bundle.css so that each is loaded individually via JS.
  • Remove the @import statement for univer-bundle.css from univer-sheet.bundle.css, relying on separate link elements injected by JS.
src/components/BootstrapBlazor.UniverSheet/wwwroot/css/univer-sheet.bundle.css

Assessment against linked issues

Issue Objective Addressed Explanation
#1095 Make UniverSheet stylesheet asset URLs compatible with fingerprinting (use runtime-resolved asset paths instead of hard-coded URLs).
#1095 Update the UniverSheet JavaScript initialization to consume the fingerprint-aware stylesheet URLs passed from the .razor component instead of using fixed paths.
#1095 Ensure both univer-bundle.css and univer-sheet.bundle.css are loaded as separate link elements so they can be fingerprinted independently (rather than using CSS @import).

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@bb-auto bb-auto Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Auto approved by bb-auto

@ArgoZhang
ArgoZhang merged commit 94c780a into master Aug 12, 2026
3 checks passed
@ArgoZhang
ArgoZhang deleted the dev-unisheet branch August 12, 2026 14:12

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • Accessing Assets[UniverBundleStylePath] and Assets[UniverSheetStylePath] assumes the keys always exist; consider using a safe lookup (e.g., TryGetValue with a fallback to the non-fingerprinted path) to avoid runtime exceptions when assets are missing or misconfigured.
  • The asset path constants (UniverBundleStylePath and UniverSheetStylePath) are hardcoded strings; if similar paths are used elsewhere, consider centralizing them or deriving them from a shared helper to reduce the risk of inconsistencies during future refactors.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Accessing `Assets[UniverBundleStylePath]` and `Assets[UniverSheetStylePath]` assumes the keys always exist; consider using a safe lookup (e.g., `TryGetValue` with a fallback to the non-fingerprinted path) to avoid runtime exceptions when assets are missing or misconfigured.
- The asset path constants (`UniverBundleStylePath` and `UniverSheetStylePath`) are hardcoded strings; if similar paths are used elsewhere, consider centralizing them or deriving them from a shared helper to reduce the risk of inconsistencies during future refactors.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(UniverSheet): assets support fingerprinting

1 participant